﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using App.Core.Extensions;
using App.Data;

public partial class Pages_Public_Testimonials : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindPageInfo();
        if (!IsPostBack)
        {
            BindTestimonials(1);
        }
    }
    protected void BindPageInfo()
    {
        Page.Title = WebUtil.GetPageTitle(h4Heading.InnerHtml);
    }
    protected void BindTestimonials(int pageNumber)
    {
        int totalRecord = 0;
        UtilityDAO dao = new UtilityDAO();
        DataSet ds = dao.GetPagedData(AppSQL.GetPagedTestimonials(true, true), null, pageNumber, ConfigReader.TestimonialListSize, out totalRecord);
        dlTestimonials.DataSource = ds.Tables[0];
        dlTestimonials.DataBind();

        ///Bind the Pager Control
        ucTestimonialListPager.TotalRecord = totalRecord;
        ucTestimonialListPager.PageNo = pageNumber;
        ucTestimonialListPager.PageSize = ConfigReader.TestimonialListSize;
        ucTestimonialListPager.DataBind();
    }
    protected String GetImageUrl(String imageFile)
    {
        return String.Format("{0}/{1}", AppConstants.TESTIMONIAL_FILES, imageFile).UrlEncode();
    }
    protected void ucTestimonialListPager_PageIndexChanged(object sender, PagerEventArgs e)
    {
        BindTestimonials(e.PageIndex);
    }
}